package cn.jhc.dao;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.SQLException;

public class NewUserDao {
	public void addNewUser( String name, String password,String displayname) {
		String sql = "insert into user(name,password,displayname) "
				+ "values(?,password(?),?)";
		PreparedStatement st = null;
		try {
			Connection con = ConnectionFactory.getConnection();
			st = con.prepareStatement(sql);			
			st.setString(1,name);
			st.setString(2, password);
			st.setString(3, displayname);
			st.executeUpdate();
		} catch (SQLException e) {
			e.printStackTrace();
		}finally {
			try {
				st.close();
			} catch (SQLException e) {
				e.printStackTrace();
			}
		}
	}

}
